package com.omega.exam.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.omega.exam.entity.Question;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 题目Mapper接口
 * 继承MyBatis Plus的BaseMapper，提供基础的CRUD操作
 */
public interface QuestionMapper extends BaseMapper<Question> {
    @Select("select category_id,count(*) as count from questions group by category_id")
    List<Map<String,Long>> getCategoryQuestionCount();

    IPage<Question> selectByPage(IPage<Question> page1, Long categoryId, String difficulty, String type, String keyword);

    List<Question> getByPId(Integer id);
}